package com.kexio.enterprise.governance.circuitbreaker.status;

import com.kexio.enterprise.governance.circuitbreaker.config.CircuitBreakerConfig;
import com.kexio.enterprise.governance.circuitbreaker.enums.CircuitBreakerState;

import java.time.LocalDateTime;

/**
 * 熔断器状态信息
 * 
 * @author Kexio
 * @since 1.0.0
 */
public class CircuitBreakerStatus {
    private String key;
    private CircuitBreakerState state;
    private CircuitBreakerConfig config;
    private long numberOfSuccessfulCalls;
    private long numberOfFailedCalls;
    private long numberOfBufferedCalls;
    private double failureRate;
    private LocalDateTime lastStateTransition;
    private LocalDateTime nextRetryTime;
    private boolean automaticTransitionEnabled;
    private long remainingWaitTime;

    // Getters and Setters
    public String getKey() { return key; }
    public void setKey(String key) { this.key = key; }
    
    public CircuitBreakerState getState() { return state; }
    public void setState(CircuitBreakerState state) { this.state = state; }
    
    public CircuitBreakerConfig getConfig() { return config; }
    public void setConfig(CircuitBreakerConfig config) { this.config = config; }
    
    public long getNumberOfSuccessfulCalls() { return numberOfSuccessfulCalls; }
    public void setNumberOfSuccessfulCalls(long numberOfSuccessfulCalls) { this.numberOfSuccessfulCalls = numberOfSuccessfulCalls; }
    
    public long getNumberOfFailedCalls() { return numberOfFailedCalls; }
    public void setNumberOfFailedCalls(long numberOfFailedCalls) { this.numberOfFailedCalls = numberOfFailedCalls; }
    
    public long getNumberOfBufferedCalls() { return numberOfBufferedCalls; }
    public void setNumberOfBufferedCalls(long numberOfBufferedCalls) { this.numberOfBufferedCalls = numberOfBufferedCalls; }
    
    public double getFailureRate() { return failureRate; }
    public void setFailureRate(double failureRate) { this.failureRate = failureRate; }
    
    public LocalDateTime getLastStateTransition() { return lastStateTransition; }
    public void setLastStateTransition(LocalDateTime lastStateTransition) { this.lastStateTransition = lastStateTransition; }
    
    public LocalDateTime getNextRetryTime() { return nextRetryTime; }
    public void setNextRetryTime(LocalDateTime nextRetryTime) { this.nextRetryTime = nextRetryTime; }
    
    public boolean isAutomaticTransitionEnabled() { return automaticTransitionEnabled; }
    public void setAutomaticTransitionEnabled(boolean automaticTransitionEnabled) { this.automaticTransitionEnabled = automaticTransitionEnabled; }
    
    public long getRemainingWaitTime() { return remainingWaitTime; }
    public void setRemainingWaitTime(long remainingWaitTime) { this.remainingWaitTime = remainingWaitTime; }
}
